/**
 * Created with IntelliJ IDEA.
 * ClassName: Computer
 * Package: PACKAGE_NAME
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-07-06
 * Time: 21:07
 */

//抽象的电脑类
public abstract class Computer {

    //品牌是一个接口 组合进来 不要继承
    protected Brand brand;

    //创建构造器 使用组合的好处
    public Computer(Brand brand){
        this.brand = brand;
    }

    //电脑出厂 设置品牌
    public void info(){
        brand.info();
    }

}


//电脑子类 台式桌面电脑
class Desktop extends Computer{

    public Desktop(Brand brand) {
        super(brand);
    }

    @Override
    public void info() {
        super.info();
        System.out.println("台式机");
    }
}

//笔记本子类
class Laptop extends Computer{

    public Laptop(Brand brand) {
        super(brand);
    }

    @Override
    public void info() {
        super.info();
        System.out.println("笔记本");
    }
}